﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace WorldSource
{
    public class Camera : Components.Component
    {
        Matrix cameraTransformation;
        Vector2 position;
        float rotation;
        Vector3 scale;
        public static Camera mainCamera;

        public void Update()
        {
        }

        public void UpdateCam(Vector2 position, float rotation, Vector3 scale)
        {
            this.position = position;
            this.rotation = rotation;
            this.scale = scale;
        }

        public Matrix getTransformation()
        {
            cameraTransformation = Matrix.CreateTranslation(new Vector3(-position.X, -position.Y, 0)) * Matrix.CreateRotationZ(rotation) * Matrix.CreateScale(scale) * Matrix.CreateTranslation(new Vector3(Game1.game.GraphicsDevice.Viewport.Width * 0.5f, Game1.game.GraphicsDevice.Viewport.Height * 0.5f, 0));
            return cameraTransformation;
        }
    }
}
